<?php
    require_once"../include/dbclass.php";
    require_once "tpl/head.html";
    $page_title = "信息安全后台管理系统";
    require_once "tpl/header.html";
    require_once "tpl/login.html";
    require_once "tpl/footer.html";
	
    if(isset($_POST['submit'])) {
        $user_name = $_POST['user-name'];
        $user_pass = $_POST['user-pass'];
        $q = 'select * from user where name= ? and password= ?';
        try {
            $pdo = new DB();
            $result = $pdo->select($q, $user_name, $user_pass);
            echo $result;
            if ($result) {
                header("location:index.php");
                exit;
            }
            else {
                header("location:login.php");
                exit;
            }
        } catch (PDOException $e) {
            $e->getMessage();
        }
    }